/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package appClient;

import com.google.gson.Gson;
import engine.AdressBooks;
import engine.FullPersone;
import engine.Persone;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.List;
import javax.swing.JTable;
import com.google.gson.reflect.TypeToken;
import engine.City;
import engine.Country;
import engine.GType;
import engine.Street;
import engine.TypeAdress;
import engine.TypePhone;
import java.lang.reflect.Type;
import java.util.ArrayList;
import protocol.ClientProtocol;
import protocol.Command;

/**
 *
 * @author User
 */
public class ClientCommand {
  public AdressBooks nb;
  
  
  public static boolean getTypePhone(ConnectClient connectClient)
  {
    String send = UserComman.commandGet("PhoneT", null);
    connectClient.refuse(send);
    return true;
  }


     public static boolean loadPT(ClientProtocol cp, ConnectClient connectClient)
     {
         try {
          cp.ab.setVisible(true);
        } catch (Exception ex) {
         
        }
        getTypePhone(connectClient);
        getTypeAdr(connectClient);
        getTypeCountry(connectClient);
       return true;
     }

    public static boolean loadPersone(FullPersone fp, ClientProtocol cp, ConnectClient connectClient) throws FileNotFoundException, IOException {
        cp.ab = new AdressBooks(fp, cp);
        loadPT(cp, connectClient);
        return true;
    }
    
    public static boolean loadTypes(ClientProtocol cp, ConnectClient connectClient) {
        cp.ab = new AdressBooks(connectClient);
        loadPT(cp, connectClient);
        return true;
    }
    
    public static boolean getTypeCountry(ConnectClient connectClient) {
        String send = UserComman.commandGet("Country", null);
        connectClient.refuse(send);
        return true;
    }

    public static boolean getTypeAdr(ConnectClient connectClient) {
        String send = UserComman.commandGet("AddrT", null);
        connectClient.refuse(send);
        return true;
    }


    
}
